<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <div class="div1">div1
        <div class="div2">div2
            <div class="div3">div3
                <span>1</span>
            </div>
        </div>
    </div>

    <script src="js/jquery-3.5.1.min.js"></script>
    <script>
        // 查找指定的祖先元素
        console.log($('span').parents('.div2'));;
    </script>
</body>
</html>